import request from '@/api/request'

export function getStaffUsers(params) {
  return request({
    url: '/wechat/wxuser/',
    method: 'GET',
    params
  })
}

export function updateStaffUser(data) {
  return request({
    url: `/wechat/wxuser/${data.id}/`,
    method: 'PATCH',
    data
  })
}



export function getWeChatUser(openid) {
  return request({
    url: `/wechat/wechat_user/${openid}/`,
    method: 'GET',
  })
}

export function updateWeChatUser(data) {
  return request({
    url: `/wechat/wechat_user/${data.openid}/`,
    method: 'PATCH',
    data
  })
}



export function getRechargeList() {
  return request({
    url: '/wechat/wx_recharge_list/',
    method: 'GET',
  })
}

export function getRechargeById(id) {
  return request({
    url: `/wechat/wx_recharge_list/${id}/`,
    method: 'GET',
  })
}

// 显示二维码
export function show_qrcode(params) {
  const res = request({
    url: '/wechat/qrcode/',
    method: 'GET',
    responseType: 'arraybuffer',
    params
  })
  return res
}

// 微信支付
export function wechatPay(data) {
  const res = request({
    url: '/wechat/pay/',
    method: 'POST',
    data
  })
  return res
}